package com.jijuxie.house.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jijuxie.house.domain.HouseCollection;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface HouseCollectionMapper extends BaseMapper<HouseCollection> {
    
    /**
     * 删除用户收藏的房源
     */
    void deleteByHouseIdAndUserId(@Param("houseId") Long houseId, @Param("userId") Long userId);
    
    /**
     * 检查是否已收藏
     */
    @Select("select count(*) from house_collection where house_id = #{houseId} and user_id = #{userId}")
    int checkCollected(@Param("houseId") Long houseId, @Param("userId") Long userId);
} 